import { IBugParams } from '../interface/bug';
import * as request from './request';

export async function getBugs(body: IBugParams) {
  try {
    const login = sessionStorage.getItem('login')?.toString();
    if (login === '1') {
      const data = request.post(JSON.stringify(body), '/api/console/bug/get');
      return data;
    } else {
      return {};
    }
  } catch (e) {
    return e;
  }
}

export async function changeStatus(body: { id: string }) {
  try {
    const data = request.post(
      JSON.stringify(body),
      '/api/console/bug/changeStatus',
    );
    return data;
  } catch (e) {
    return e;
  }
}
